import config from '../commonApi'
import qs from 'qs'

const REGISTER = `${config.HOST}/auth/register`
const LOGIN = `${config.HOST}/auth/login`
const UPDATEPASSWORD = `${config.HOST}/user/updatePassword`
const SENDCODE = `${config.HOST}/auth/sendCode`
const GET_USERINFO = `${config.HOST}/user/infos`
const GETDIVIDENDRULE = `${config.HOST}/platform/getDividendRule`

// 获取所有种类的币种比赛接口
const GET_CURRENCYTYPE = `${config.HOST}/race/raceCoinTypeList`
// 获取所有种类的币种比赛房间接口
const GET_RACELIST = `${config.HOST}/race/raceAmountRoomList`
// 跑马灯
const NOTICEBAR = `${config.HOST}/race/raceRankWinner`
// 比赛投注
const GAME_BETTING = `${config.HOST}/race/touZhu`
// 往期中奖名单[pageNum,pageSize]
const PAST_WINNERSLIST = `${config.HOST}/race/raceWinnerLog`
// 用户历史投注记录
const PAST_BETTING = `${config.HOST}/race/raceHistoryList`
// 平台分红
const PLATFORM_PROFITS = `${config.HOST}/platform/dividend`
// 分红榜
const PLATFORM_LIST = `${config.HOST}/platform/dividendRank`
// 邀请好友
const INVITEINFOS = `${config.HOST}/user/inviteInfos`
// 我的头部
const GET_PRIVATEHEAD = `${config.HOST}/dividend/myDividend`
// 我的资产
const GET_ACCOUNT = `${config.HOST}/account/my`
// 我的分红
const GET_PROFITS = `${config.HOST}/dividend/myDividendHistoryList`
// 我的-流水明细
const GET_FLOW = `${config.HOST}/account/flow`
// 房间号
const RACEAMOUNTTYPELIST = `${config.HOST}/race/raceAmountTypeList`
// 提币
const TRANSFER_OUT = `${config.HOST}/transfer/out`

export default {
  register: (paramJson) => {
    return config.axios.post(REGISTER, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  login: (paramJson) => {
    return config.axios.post(LOGIN, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  updatePassword: (paramJson) => {
    return config.axios.post(UPDATEPASSWORD, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  sendCode: (paramJson) => {
    return config.axios.post(SENDCODE, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  getUserinfo: () => {
    return config.axios.post(GET_USERINFO)
  },
  raceAmountTypeList: () => {
    return config.axios.post(RACEAMOUNTTYPELIST)
  },
  // 获取所有种类的币种比赛接口
  getCurrencytype: () => {
    return config.axios.post(GET_CURRENCYTYPE)
  },
  getRacelist: (paramJson) => {
    return config.axios.post(GET_RACELIST, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  // 跑马灯
  noticeBar: () => {
    return config.axios.post(NOTICEBAR)
  },
  gameBetting: (paramJson) => {
    return config.axios.post(GAME_BETTING, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  // 往期中奖名单[pageNum,pageSize]
  pastWinnerslist: (paramJson) => {
    return config.axios.post(PAST_WINNERSLIST, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  // 用户历史投注记录
  pastBetting: (paramJson) => {
    return config.axios.post(PAST_BETTING, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  // 平台分红
  platformProfits: () => {
    return config.axios.post(PLATFORM_PROFITS)
  },
  // 分红榜
  platformList: () => {
    return config.axios.post(PLATFORM_LIST)
  },
  // 邀请好友
  getInviteinfos: () => {
    return config.axios.post(INVITEINFOS)
  },
  getDividendrule: () => {
    return config.axios.post(GETDIVIDENDRULE)
  },
  // 我的头部信息
  getPrivatehead: (paramJson) => {
    return config.axios.post(GET_PRIVATEHEAD)
  },
  // 我的资产
  getAccount: () => {
    return config.axios.post(GET_ACCOUNT)
  },
  // 我的分红
  getProfits: (paramJson) => {
    return config.axios.post(GET_PROFITS, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  // 我的-流水明细
  getFlow: (paramJson) => {
    return config.axios.post(GET_FLOW, qs.stringify(Object.assign({}, config.params, paramJson)))
  },
  // 提币
  transferOut: (paramJson) => {
    return config.axios.post(TRANSFER_OUT, qs.stringify(Object.assign({}, config.params, paramJson)))
  }
}
